# -*- coding: utf-8 -*-

import os
import sys

UNK = "UNK"
NER_SCHEMA = "BMEOS"
type_dict = {"医学专科": "SPE", "检查科目": "CHK", "药物": "MED", "症状": "SYM", "疾病": "DIS", "细菌": "BAC", "病毒": "VIR", "NoneType": "Non", UNK: UNK}

if len(sys.argv) < 2:
    out_file = "ner_type_vocabs.txt"
else:
    out_file = sys.argv[1]

count = 0
ner_types = {}
for ner in NER_SCHEMA:
    for types in type_dict.values():
        name = "{}-{}".format(ner, types)
        ner_types[name] = count
        count += 1


print("Write ner-type vocabs to ", out_file, " ...", end="")
with open(out_file, 'w') as f:
    for key, value in ner_types.items():
        f.write(key+"\n")

print(" done.")
